package com.nick.sscplan.ui;

import java.util.List;

import com.nick.sscplan.bean.SscInfo;
import com.nick.sscplan.provider.SscDAO;
import com.nick.sscplan.util.SscUtils;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;

public class Ssc_HistoryActivity extends Activity{

    private Spinner mSpinner = null;
    private ListView mListView = null;
    private TextView mTextView = null;
    private SscDAO mSscDAO;
    private static final String TAG = "ssc_plan";
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ssc_history);
        init();
    }
    
    @SuppressLint("ParserError")
    private void init(){
        mSpinner = (Spinner) findViewById(R.id.history_pick);
        mListView = (ListView) findViewById(R.id.history_list);
        mTextView = (TextView) findViewById(R.id.history_test);
        mSscDAO = new SscDAO(this);
        List<String> list = SscUtils.getHistoryDate();
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
        mSpinner.setAdapter(adapter);
        String date = mSpinner.getItemAtPosition(0) + "";
        List<SscInfo> history_list = mSscDAO.queryByDate(date);
        mTextView.setText(history_list.toString() + "");
//        ArrayAdapter<String> lisAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
    }
    
}
